<?php 
if (!isset($_SESSION)) {
  session_start();
}
class gallery extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
       protected $configs;
       function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('smarty3');
            $this->load->model('pushclimb/gallery_model');
            $this->load->model('pushclimb/video_model');
            $this->smarty=new CI_Smarty3();$this->smarty->error_reporting = E_ALL & ~E_NOTICE;
            $this->gallery_model=new gallery_model();
            $this->video_model= new video_model();
        }
        public function index()
	{
            $Data["videos"]=$this->video_model->gets();
            $Data["gallerys"]=$this->gallery_model->gets();
            foreach($Data["gallerys"] as $g){
                $Data[$g->_id]=$this->gallery_model->getdetail($g->_id,$g->_amount);
            }
            $this->smarty
                    ->assign('_SESSION', $_SESSION)
                    ->assign('Data', $Data)
                    ->display("pushclimbing/pages/07_gallery");
        }
        function detail($alias=""){
            $gas=$this->gallery_model->getByAlias($alias);
            $Data["gallery"]=$gas[0];
            $Data["videos"]=$this->video_model->gets();
            $this->smarty
                    ->assign('_SESSION', $_SESSION)
                    ->assign('Data', $Data)
                    ->display("pushclimbing/pages/08_gallery_detail");
        }
        
}

